package cn.iocoder.yudao.module.member.assets.vo;

import cn.iocoder.yudao.framework.business.basic.pojo.dto.QueryDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.AssertTrue;
import lombok.Data;

@Schema(description = "联盟豆明细查询 QueryVO")
@Data
@Valid
public class AppCryptocurrencyListQueryDTO extends QueryDTO {

    @Schema(description = "是否收益豆", example = "true")
    private Boolean increment;

    @Schema(description = "业务类型，如：cryptocurrency_deduction-抵扣现金", example = """
            [
                        {
                            "code": "cryptocurrency_deduction",
                            "name": "抵扣现金"
                        },
                        {
                            "code": "cryptocurrency_to_money",
                            "name": "兑换零钱"
                        },
                        {
                            "code": "cryptocurrency_input",
                            "name": "转入"
                        },
                        {
                            "code": "cryptocurrency_output",
                            "name": "转出"
                        }
            ]
            """)
    private String bizType;

    @Schema(description = "年份，如：2025")
    private Integer year;

    @Schema(description = "月份，如：3")
    private Integer month;

    @SuppressWarnings("unused")
    @AssertTrue(message = "年份和月份不能为空")
    public boolean validateYearAndMonth() {
        if (year == null && month == null) {
            return true;
        }
        return year != null && year > 0 && month != null && month > 0;
    }

}